define(['./initial'], function() {
    var app = angular.module('App.tool');
    app.factory('defineTheme', [

        function() {
            var thems = {
                dark: function() {
                    if (!Highcharts.themeDark) {
                        Highcharts.themeDark = {
                            colors: ["#E74032", "#71B7DD", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
                                "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"
                            ],
                            chart: {
                                backgroundColor: "#333",
                                borderColor: '#000000',
                                borderWidth: 1,
                                className: 'dark-container',
                                plotBackgroundColor: '#333',
                                plotBorderColor: 'transparent',
                                plotBorderWidth: 1
                            },
                            title: {
                                style: {
                                    color: '#C0C0C0',
                                    fontFamily: "'Microsoft Yahei', Verdana",
                                    font: 'bold 16px "Microsoft Yahei", Verdana, sans-serif'
                                },
                                x: 8
                            },
                            subtitle: {
                                style: {
                                    color: '#666666',
                                    font: 'bold 12px "Microsoft Yahei", Verdana, sans-serif'
                                }
                            },
                            xAxis: {
                                gridLineColor: '#333333',
                                gridLineWidth: 0,
                                labels: {
                                    style: {
                                        color: '#ddd'
                                    }
                                },
                                lineColor: '#ddd',
                                tickColor: '#ddd',
                                title: {
                                    style: {
                                        color: '#CCC',
                                        fontWeight: 'bold',
                                        fontSize: '12px',
                                        fontFamily: 'Verdana, sans-serif'

                                    }
                                }
                            },
                            yAxis: {
                                gridLineColor: '#333333',
                                labels: {
                                    style: {
                                        color: '#A0A0A0'
                                    }
                                },
                                lineColor: '#A0A0A0',
                                minorTickInterval: null,
                                tickColor: '#A0A0A0',
                                tickWidth: 1,
                                title: {
                                    style: {
                                        color: '#CCC',
                                        fontWeight: 'bold',
                                        fontSize: '12px',
                                        fontFamily: 'Verdana, sans-serif'
                                    }
                                }
                            },
                            tooltip: {
                                backgroundColor: 'rgba(0, 0, 0, 0.75)',
                                style: {
                                    color: '#F0F0F0'
                                }
                            },
                            toolbar: {
                                itemStyle: {
                                    color: 'silver'
                                }
                            },
                            plotOptions: {
                                line: {
                                    dataLabels: {
                                        color: '#CCC'
                                    },
                                    marker: {
                                        lineColor: '#333'
                                    }
                                },
                                spline: {
                                    marker: {
                                        lineColor: '#333'
                                    }
                                },
                                scatter: {
                                    marker: {
                                        lineColor: '#333'
                                    }
                                },
                                candlestick: {
                                    lineColor: 'white'
                                }
                            },
                            legend: {
                                itemStyle: {
                                    font: '9pt Verdana, sans-serif',
                                    color: '#A0A0A0'
                                },
                                itemHoverStyle: {
                                    color: '#FFF'
                                },
                                itemHiddenStyle: {
                                    color: '#35362E'
                                }
                            },
                            credits: {
                                style: {
                                    color: '#666'
                                }
                            },
                            labels: {
                                style: {
                                    color: '#CCC'
                                }
                            },

                            navigation: {
                                buttonOptions: {
                                    symbolStroke: '#DDDDDD',
                                    hoverSymbolStroke: '#FFFFFF',
                                    theme: {
                                        fill: {
                                            linearGradient: {
                                                x1: 0,
                                                y1: 0,
                                                x2: 0,
                                                y2: 1
                                            },
                                            stops: [
                                                [0.4, '#606060'],
                                                [0.6, '#333333']
                                            ]
                                        },
                                        stroke: '#000000'
                                    }
                                }
                            },

                            // scroll charts
                            rangeSelector: {
                                buttonTheme: {
                                    fill: {
                                        linearGradient: {
                                            x1: 0,
                                            y1: 0,
                                            x2: 0,
                                            y2: 1
                                        },
                                        stops: [
                                            [0.4, '#888'],
                                            [0.6, '#555']
                                        ]
                                    },
                                    stroke: '#000000',
                                    style: {
                                        color: '#CCC',
                                        fontWeight: 'bold'
                                    },
                                    states: {
                                        hover: {
                                            fill: {
                                                linearGradient: {
                                                    x1: 0,
                                                    y1: 0,
                                                    x2: 0,
                                                    y2: 1
                                                },
                                                stops: [
                                                    [0.4, '#BBB'],
                                                    [0.6, '#888']
                                                ]
                                            },
                                            stroke: '#000000',
                                            style: {
                                                color: 'white'
                                            }
                                        },
                                        select: {
                                            fill: {
                                                linearGradient: {
                                                    x1: 0,
                                                    y1: 0,
                                                    x2: 0,
                                                    y2: 1
                                                },
                                                stops: [
                                                    [0.1, '#000'],
                                                    [0.3, '#333']
                                                ]
                                            },
                                            stroke: '#000000',
                                            style: {
                                                color: 'yellow'
                                            }
                                        }
                                    }
                                },
                                inputStyle: {
                                    backgroundColor: '#333',
                                    color: 'silver'
                                },
                                labelStyle: {
                                    color: 'silver'
                                }
                            },

                            navigator: {
                                handles: {
                                    backgroundColor: '#666',
                                    borderColor: '#AAA'
                                },
                                outlineColor: '#CCC',
                                maskFill: 'rgba(16, 16, 16, 0.5)',
                                series: {
                                    color: '#7798BF',
                                    lineColor: '#A6C7ED'
                                }
                            },

                            scrollbar: {
                                backgroundColor: {
                                    linearGradient: {
                                        x1: 0,
                                        y1: 0,
                                        x2: 1,
                                        y2: 1
                                    },
                                    stops: [
                                        [0, '#333333'],
                                        [1, '#3C3C3C']
                                    ]
                                },
                                barBorderColor: '#CCC',
                                buttonArrowColor: '#CCC',
                                buttonBackgroundColor: {
                                    linearGradient: {
                                        x1: 0,
                                        y1: 0,
                                        x2: 0,
                                        y2: 1
                                    },
                                    stops: [
                                        [0.4, '#888'],
                                        [0.6, '#555']
                                    ]
                                },
                                buttonBorderColor: '#CCC',
                                rifleColor: '#FFF',
                                trackBackgroundColor: {
                                    linearGradient: {
                                        x1: 0,
                                        y1: 0,
                                        x2: 0,
                                        y2: 1
                                    },
                                    stops: [
                                        [0, '#000'],
                                        [1, '#333']
                                    ]
                                },
                                trackBorderColor: '#666'
                            },

                            // special colors for some of the
                            legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
                            background2: 'rgb(35, 35, 70)',
                            dataLabelsColor: 'rgba(255,255,255,0.2)',
                            textColor: '#C0C0C0',
                            maskColor: 'rgba(255,255,255,0.3)'
                        };
                    }
                    // Apply the theme
                    var highchartsOptions = Highcharts.setOptions(Highcharts.themeDark);
                },
                light: function() {
                    if (!Highcharts.themeLight) {
                        Highcharts.themeLight = { //'#00B3F7', '#E94E51'
                            colors: ['#E94E51', '#0FBDFF', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
                            chart: {
                                backgroundColor: "#F7F7F7",
                                borderColor: 'transparent',
                                borderWidth: 0,
                                borderRadius: 5,
                                plotBackgroundColor: 'transparent',
                                plotBorderColor: 'transparent',
                                style: {
                                    fontFamily: '"Microsoft Yahei", Verdana', // default font
                                    fontSize: '11px',
                                    borderLeftBottomRaduis: "5px",
                                    borderRightBottomRaduis: "5px"
                                },
                                spacing: [40, 40, 40, 40],
                                margin: [30, 30, 50, 50]
                            },
                            title: {
                                style: {
                                    color: '#707070',
                                    font: '16px Verdana'
                                }
                            },
                            xAxis: {
                                gridLineColor: '#EBEBEB',
                                gridLineWidth: 1,
                                lineColor: '#9A9D8A',
                                tickColor: '#9A9D8A',
                                labels: {
                                    style: {
                                        color: '#717461',
                                        font: '12px  Verdana'
                                    }
                                },
                                title: {
                                    style: {
                                        color: '#717461',
                                        fontSize: '12px',
                                        fontFamily: '"Microsoft Yahei" , Verdana'

                                    }
                                }
                            },
                            yAxis: {
                                gridLineColor: '#EBEBEB',
                                gridLineWidth: 1,
                                lineColor: '#9A9D8A',
                                lineWidth: 1,
                                tickColor: '#9A9D8A',
                                labels: {
                                    style: {
                                        color: '#717461',
                                        font: '14px  Verdana'
                                    }
                                },
                                title: {
                                    style: {
                                        color: '#717461',
                                        fontSize: '14px',
                                        fontFamily: '"Microsoft Yahei" , Verdana'

                                    }
                                }
                            },
                            labels: {
                                style: {
                                    color: '#99b'
                                }
                            }
                        };
                    }
                    // Apply the theme
                    Highcharts.setOptions(Highcharts.themeLight);
                },
                transparent: function() {
                    if (!Highcharts.themeTransparent) {
                        Highcharts.themeTransparent = {
                            colors: ['#E94E51', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
                            chart: {
                                borderWidth: 0,
                                backgroundColor: '#333',
                                plotBackgroundColor: 'transparent',
                                plotBorderColor: 'transparent',
                                style: {
                                    borderBottomLeftRadius: "6px",
                                    borderTopLeftRadius: "6px"
                                },
                            },
                            title: {
                                style: {
                                    color: '#fff',
                                    font: '2rem Verdana',
                                    fontWeight: 'bolder'
                                }
                            },
                            xAxis: {
                                gridLineColor: 'tranparent',
                                labels: {
                                    style: {
                                        color: '#aaa',
                                        font: '12px Verdana'
                                    }
                                },
                                lineColor: '#aaa',
                                minorGridLineColor: '#505053',
                                tickColor: '#aaa',
                                title: {
                                    style: {
                                        color: '#aaa'
                                    }
                                }
                            },
                            yAxis: {
                                gridLineColor: '#707073',
                                labels: {
                                    style: {
                                        color: '#E0E0E3'
                                    }
                                },
                                gridLineWidth: 1,
                                lineColor: '#707073',
                                minorGridLineColor: '#707073',
                                tickColor: '#393939',
                                tickWidth: 0.5,
                                title: {
                                    style: {
                                        color: '#A0A0A3'
                                    }
                                }
                            },
                            labels: {
                                style: {
                                    color: '#99b'
                                }
                            }
                        };
                    }
                    // Apply the theme
                    Highcharts.setOptions(Highcharts.themeTransparent);
                }
            };
            return thems;
        }
    ]);
});
